﻿using SharedContracts.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TalentDesk.Contracts.Ef;
using TalentDesk.Contracts.ServiceContracts;
using TalentDesk.Mvc.HelperClasses;

namespace TalentDesk.Mvc.Models
{
    public class AuthenticationProxy
    {
        public static User AuthenticateUser(string userName, string password)
        {
            User result = null;
            new ProxyHelper<IAuthenticationService>().Use(serviceProxy =>
            {
                result = serviceProxy.AuthenticateUser(userName, password);
            },
              EndpointConstants.BasicHttpBinding_IAuthenticationService);

            return result;
        }

        public static List<Menu> GetMenus(bool? p_bIsActive = true)
        {
            List<Menu> result = null;
            new ProxyHelper<IAuthenticationService>().Use(serviceProxy =>
            {
                result = serviceProxy.GetMenus(p_bIsActive);
            },
              EndpointConstants.BasicHttpBinding_IAuthenticationService);

            return result;
        }

        public static List<User> GetUser()
        {
            List<User> result = null;
            new ProxyHelper<IAuthenticationService>().Use(serviceProxy =>
            {
                result = serviceProxy.GetUsers(true);
            },
              EndpointConstants.BasicHttpBinding_IAuthenticationService);

            return result;
        }
    }
}